import { RootState } from "@/store";
import { useSelector } from "react-redux";
import { Navigate } from "react-router-dom";

const AuthRouter = ({children}:{children:React.ReactNode}) => {
  const token = useSelector((state:RootState)=>state.user.token)
  if (!token) {
    return <Navigate to="/login" />
  }
  return <>{children}</>
};
export default AuthRouter;
